<?php
	include_once '../../Model/Room.php';
	
?>

<!-- Danh sách người dùng đặt phòng -->
<?php ?>
<table class="cgrid" id="tblUserRoom" width="100%">
<tr class="title">
	<th width="3%">順番</th>
	<th width="12%">アカウント名</th>
	<th width="18%">ユーザ名</th>
	<th width="7%">室</th>
	<th width="15%">スタートタイミング</th>
	<th width="15%">スタートタイミング</th>
	<th width="10%">料金</th>
	<th width="10%">状態</th>
	<th width="10%">オペレーション</th>
</tr>
<?php 
	$room_id= $_REQUEST['room_id'];
	$uname = $_REQUEST['uname'];
	$page = $_REQUEST['page'];
	$date=$_REQUEST['date'];
	$per_page = $_REQUEST['per_page'];
	$type=1;
	$rs = new Room();
	$result = $rs->get_list_user_room($room_id, $uname, $date, $page, $per_page, $type);
	if($result!=NULL){
		for($i=0;$i<count($result);$i++){
			echo '<tr height=22px><td align=center>'.($i+1).'</td>';
			echo '<td align=left>'.$result[$i]['username'].'</td>';
			echo '<td align=left>'.$result[$i]['name'].'</td>';
			echo '<td align=center>'.$result[$i]['room_name'].'</td>';
			echo '<td align=center>'.$result[$i]['start_time'].'</td>';
			echo '<td align=center>'.$result[$i]['end_time'].'</td>';
			echo '<td align=center>'.$result[$i]['total'].'</td>';
			echo '<td align=center>'.$result[$i]['status'].'</td>';
			echo '<td align="center"><a href="javascript:popup_user_room(\''.$result[$i]['id'].'\',\'view\')"><span title="詳細を見る"><img src="lib/images/open.gif"></a>&nbsp;
				<a href="javascript:popup_user_room(\''.$result[$i]['id'].'\',\'edit\')"></span><span title="室情報を編成する"><img src="lib/images/edit.gif" ></span></a>
				</span><a href="javascript:cancel_room(\''.$result[$i]['id'].'\',\''.$result[$i]['start_time'].'\')"><span title="予約をキャンセルする"><img src="lib/images/delete.jpg" onclick=""></span></td>
    			</tr>';
		}
	}
?>
</table>
<br>
<script type="text/javascript">
function popup_user_room(id, type){
	_popup("data/room/book_room/popup_user_room.php?&order_id="+id+"&type="+type, this.id, 950, 600);
}
$(document).ready(function() {
	
		
}); 	
	
</script>